package com.example.demo.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.example.demo.entity.User;
import com.example.demo.mapper.UserMapper;
import com.example.demo.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 *
 * User 表数据服务层接口实现类
 *
 */
@Service
@Transactional
public class UserServiceImpl  extends ServiceImpl<UserMapper, User> implements  IUserService{


	@Autowired
	private UserMapper userMapper;

	@Override
	public User selectUserByName(String name) {

		List<User> list = userMapper.selectList(new EntityWrapper<User>().eq("name", "李超"));
		User user = list.get(0);
		return user;
	}

	@Override
	public Page<User> selectUserList(Page<User> page, Integer age) {
		return page.setRecords(userMapper.selectUserList(page, age));
	}

}